﻿Imports Microsoft.VisualBasic

Public Class Ship
    Private m_isDead As Boolean
    Private m_Size As Integer
    Private m_Placed As Boolean
    Private m_Name As String
    Public HorizontalSprites() As Image
    Public VerticalSprites() As Image

    Sub New()

    End Sub

    Public Property Size() As Integer
        Get
            Return m_Size
        End Get
        Set(ByVal value As Integer)
            m_Size = value
        End Set
    End Property

    Public Property isPlaced() As Boolean
        Get
            Return m_Placed
        End Get
        Set(ByVal value As Boolean)
            m_Placed = value
        End Set
    End Property

    Public Property IsDead() As Boolean
        Get
            Return m_isDead
        End Get
        Set(ByVal value As Boolean)
            m_isDead = value
        End Set
    End Property

    'constructor
    Public Sub New(size As Integer)
        Me.m_Size = size
        Me.m_isDead = False
        Me.SetSprites()
    End Sub

    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = value
        End Set
    End Property

    Sub SetSprites()
        ReDim HorizontalSprites(Me.Size)
        ReDim VerticalSprites(Me.Size)

        Select Case Me.Size

            Case 5 'Aircraft carrier
                HorizontalSprites(1) = My.Resources.a11
                HorizontalSprites(2) = My.Resources.a12
                HorizontalSprites(3) = My.Resources.a13
                HorizontalSprites(4) = My.Resources.a14
                HorizontalSprites(5) = My.Resources.a15
                VerticalSprites(1) = My.Resources.a21
                VerticalSprites(2) = My.Resources.a22
                VerticalSprites(3) = My.Resources.a23
                VerticalSprites(4) = My.Resources.a24
                VerticalSprites(5) = My.Resources.a25
                Name = "Aircraft Carrier"

            Case 4 ' Battleship
                HorizontalSprites(1) = My.Resources.b11
                HorizontalSprites(2) = My.Resources.b12
                HorizontalSprites(3) = My.Resources.b13
                HorizontalSprites(4) = My.Resources.b14
                VerticalSprites(1) = My.Resources.b21
                VerticalSprites(2) = My.Resources.b22
                VerticalSprites(3) = My.Resources.b23
                VerticalSprites(4) = My.Resources.b24
                Name = "Battleship"

            Case 3 'Submarine and Destroyer (but I only made the second one so far)
                HorizontalSprites(1) = My.Resources.d11
                HorizontalSprites(2) = My.Resources.d12
                HorizontalSprites(3) = My.Resources.d13
                VerticalSprites(1) = My.Resources.d21
                VerticalSprites(2) = My.Resources.d22
                VerticalSprites(3) = My.Resources.d23
                Name = "Destroyer"

            Case 2 'patrol boat
                HorizontalSprites(1) = My.Resources.e11
                HorizontalSprites(2) = My.Resources.e12
                VerticalSprites(1) = My.Resources.e21
                VerticalSprites(2) = My.Resources.e22
                Name = "Patrol Boat"

            Case Else
                'Not a thing in battleship

        End Select

    End Sub

End Class
